﻿@model BetterTaskList.Models.Profile
           
@{
    ViewBag.Title = "Progress";
    Layout = "~/Views/Shared/_SideBarContent.cshtml";
 }

    <div id="sidebar">

@*    <div style="float: left; text-align:center; width: 180px; padding-bottom:20px; margin:auto; ">
        <img src="@Url.Content(BetterTaskList.Helpers.UserHelpers.GetUserAvatarUrl(Model.UserId, "128x128"))" alt="avatar" height="128px" width="128px" />
    </div>*@

    <div>
       @Html.Partial("_MyCoWorkers")
    </div> 


    </div>

    <div id="content">
        <div style="width:615px; padding-right:8px; float:left;">

    @using (Html.BeginForm("PostStatusStream", "Stream", new { area = "" }, FormMethod.Post))
    {	
    <div style="float:left;">
        @Html.TextBox("StreamDetails", null, new { @Style = "height:28px; font-size:14px; width:414px;" })
    </div>

    <div style="float:left; padding-left:4px; padding-bottom:2px;">
        <input type="button" id="Share" value="Share" />
    </div>
    <div class="clear"></div>
        
    }

@*    <div style="font-size:10px; padding-left:38px; padding-bottom:14px;">
        @Html.ActionLink("Messages", "messages", "Home", new { style = "text-decoration:none;" }) | @Html.ActionLink("Events", "Events", "Home", new { style = "text-decoration:none;" }) | @Html.ActionLink("News Feed", "NewsFeed", "Home", new { style = "text-decoration:none;" }) | @Html.ActionLink("Coworkers", "Coworkers", "Home", new { style = "text-decoration:none;" })
    </div>*@


    @*// Stream Area*@

@{var sid = Convert.ToInt32(Request.QueryString["sid"]);}
@foreach (var stream in new BetterTaskList.Models.StreamRepository().GetSingleStream(sid))
{

    <div class="clear"></div>
    <div style="padding-left: 4px; padding-top: 8px; padding-bottom: 8px;">
    <div style="float: left; height: 50px; width: 50px;">
    <a href="@Url.Action("Profile", "Home", new { area = "", id = stream.StreamCreatorUserId })" >
        <img src="@Url.Content(BetterTaskList.Helpers.UserHelpers.GetUserAvatarUrl(stream.StreamCreatorUserId, "64x64"))" alt="avatar" height="50px" width="50px" />
    </a>
    </div>
    <div style="float: left; padding: 3px 0px 3px 12px; font-size: 12px; width: 80%; font-size: 10px;">
        @{var streamId = "stream" + stream.StreamId;}
        <b>@Html.ActionLink(@stream.StreamCreatorFullName, "Profile", "Home", new { area = "", id = stream.StreamCreatorUserId }, new { @Style = "text-decoration:none", @Name = streamId })</b>
    </div>
    <div style="float: left; padding-left: 12px; width: 80%; font-size: 10px;">
           
           @*grab the value of the request string*@
           @{var cid = Convert.ToInt32(Request.QueryString["cid"]);}
           
            @if (cid == stream.StreamId)
            {<b> @stream.StreamDetails</b>}
            else
            { @stream.StreamDetails }

        <br />
        @{var replyToStream = "ReplyToStream" + @stream.StreamId;} 
        <div style="color: #999999;">@stream.StreamCreatedTimeSpan - <a class="comment_link" style="color:#999999; text-decoration:none; " href="#" id="@stream.StreamId">comment</a>
        </div>
    </div>
    <div class="clear">
    </div>
</div>
    
    
 //Stream replys            
 foreach (var reply in new BetterTaskList.Models.StreamRepository().GetStreamComments(sid))
 {
    <div id="@reply.StreamId" style="width:351px; margin-left: 66px; margin-bottom: 2px; background-color: #EDEFF4; border-bottom: 1px solid #E5EAF1;">
        <div style="float: left; height: 32px; width: 32px;">
        <a href="@Url.Action("Profile", "Home", new { area = "", id = reply.StreamCommentSubmitterUserId })" >
            <img src="@Url.Content(BetterTaskList.Helpers.UserHelpers.GetUserAvatarUrl(reply.StreamCommentSubmitterUserId, "64x64"))" height="32px" width="32px" alt="avatar"/>
        </a>  
        </div>
        <div style="float: left; padding: 3px 0px 0px 12px; font-size: 12px; width:80%; font-size: 10px;">
            @{var streamReplyName = "StreamReply" + reply.StreamId;}
            <b>@Html.ActionLink(@reply.StreamCommentSubmitterFullName, "Profile", "Home", new { area = "", id = reply.StreamCommentSubmitterUserId }, new { Style = "text-decoration:none", @Name = streamReplyName })</b> <span style="color: #999999; font-size:9px;">@reply.StreamCommentCreatedTimeSpan </span>
        </div>
        <div style="float: left; padding-left: 12px; width: 80%; font-size: 10px;">

            @if (cid == reply.StreamId)
            {<b> @reply.StreamCommentDetails</b>}
            else
            { @reply.StreamCommentDetails }
           
            <br />
        </div>
        <div class="clear">
        </div>
    </div>
   } // closes the var reply in GetStreamReplys(#)


   // reply form to reply to parent stream
    using (Html.BeginForm("PostStatusStreamComment", "Stream", new { area = "", replyToStreamId = sid }, FormMethod.Post))
   {		
        <div class="clear"> </div>
        
        <div id="@replyToStream" style="float: left; margin-left: 65px; background-color:#EDEFF4; padding-bottom: 5px;  padding-top: 3px;">
            <div style="float: left;">
                @Html.TextBox("StreamCommentDetails", null, new { @style = "width:350px; color:#999999; border: 1px solid #CCCCCC; font-size:10px; height:18px;", @Class = "StreamReplyTextBox" })
            </div>
        </div>

        <div class="clear"></div>
    
                                                                                                                                                    }

} @*// closes the var stream in GetStream() loop*@

</div>
    </div>

<script src="@Url.Content("~/Scripts/jquery.watermark.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#StreamDetails").watermark(" Write something...", "watermark");
        $("#Share").button();
        $(".StreamReplyTextBox").watermark(" Reply to comment...", "watermark");
    });

</script>